<?php
require_once(dirname(__FILE__)."/../../config/config.php"); 
if($_REQUEST['method']=="latest_movie"){
	getPrograms(4,"latest");
}else if($_REQUEST['method']=="latest_series"){
	getPrograms(3,"latest");
}else if($_REQUEST['method']=="latest_entertainment"){
	getPrograms(1,"latest");
}else if($_REQUEST['method']=="popular_movie"){
	getPrograms(4,"popular");
}else if($_REQUEST['method']=="popular_series"){
	getPrograms(3,"popular");
}else if($_REQUEST['method']=="popular_entertainment"){
	getPrograms(1,"popular");
}else if($_REQUEST['method']=="recommend_movie"){
	getPrograms(4,"recommend");
}else if($_REQUEST['method']=="recommend_series"){
	getPrograms(3,"recommend");
}else if($_REQUEST['method']=="recommend_entertainment"){
	getPrograms(1,"recommend");
}
exit();
function getPrograms($type_id,$status){
	if($status=="latest"){
		$where="latest=1";
	}else if($status=="popular"){
		$where="popular=1";
	}if($status=="recommend"){
		$where="recommend=1";
	}
	$sql="SELECT * FROM zy_iptvprogram_list WHERE ".$where." AND type_id=$type_id;";
	$rs=mysql_query($sql);
	$message=array();
	while($row=mysql_fetch_array($rs)){	
		$message[] =array(
			'program_id'=>$row['program_id'],
			'title'=>$row['title'],
	        'year'=>$row['year'],
			'type_id'=>$row['type_id'],
			'category'=>$row['category'],
	        'country'=>$row['country'],
			'language'=>$row['language'],
			'package_id'=>$row['package_id'],
	        'actor'=>$row['actor'],
			'duration'=>$row['duration'],
			'classification'=>$row['classification'],
	        'score_rating'=>$row['score_rating'],
			'video_link'=>$row['video_link'],
			'is_have_list'=>$row['is_have_list'],
	        'video_info'=>$row['video_info'],
			'pic_link_large'=>$row['pic_link_large'],
	        'pic_link_small'=>$row['pic_link_small'],
			'play_count'=>$row['play_count'],
			'latest'=>$row['latest'],
			'popular'=>$row['popular'],
			'recommend'=>$row['recommend']
		);
	}
	echo json_encode($message);
}





	
	
	
